<template>
  <el-button
    type="primary"
    plain
    size="mini"
    style="margin-bottom: 5px"
    :disabled="item.disabled||false"
    @click="handleClick"
  >{{ item.name }}
  </el-button>
</template>

<script>

import base from '../mixin/base'

export default {
  name: 'HeyTableElButtonOther',
  components: {},
  mixins: [base],
  data() {
    return {}
  },
  computed: {},
  created() {
    const operateParam__ = {
      isValid: false
    }
    this.setParam({ ...this.operateParam_, ...operateParam__, ...this.operateParam, ...this.item.operateParam }, true)
  },
  mounted() {
  },
  methods: {
    canOpen() {
      const { selected, item } = this
      const { selectType } = item
      return this.isSelected(selected, selectType)
    },
    validate() {
      const { selected, operateParam_ } = this
      const { isValid, validate } = operateParam_
      return !isValid || this.canOper(selected, validate)
    },
    operate() {
      const { operateParam_ } = this
      if (!this.canOpen() || !this.validate()) {
        return
      }

      const { fn } = operateParam_
      const { selected } = this
      fn && fn.call(this, selected, operateParam_)
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
